<?php session_start(); $_SESSION['page'] = 'admin';?>
<!doctype html public "-//W3C//DTD HTML 4.01//EN">
<?php
    require('db_connection.php');
    $userType = $_COOKIE['userType'];

    if($userType == 'superadministrator')
    {
        $query = "SELECT * FROM tbladmin";
    }
    else
    {
        $libraryNo = $_COOKIE['libraryNo'];
        $query = "SELECT * FROM tbladmin WHERE libraryNo=$libraryNo and userType='administrator' or userType='staff'";
    }
    $ctr=1;
    $result = mysql_query($query);
    $ctr1 = mysql_num_rows($result);
?>


<html>

   <head>
      <title>Administrator Result</title>
      <meta http-equiv="generator" content="PHP Designer 2005" />
      <style type="text/css">
        @import url(style.css);
      </style>
   </head>

   <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000" class=''>

    <table border='1' width='80%' align='center' class='content'>
        <tr><td><img src='images/banner1.jpg'></td></tr>
        <tr><td align='right' class='logout'><?php require ('loginout.php');?></td></tr>
        <tr><td><?php require('buttons.php'); ?></td></tr>
        <tr><td height='15'></td></tr>
        <tr><td>

        </td></tr>
        <tr><td height='15'></td></tr>
        <tr><td>
        <?php echo "<form method='post' action='delete.php?page=admin&adminCtr=$ctr1'";?>
        <table align='center' border='1' cellpadding='5' width='80%'>
  
        <?php

                          echo "<table  align='center'><tr><td>User Name</td><td>User Type</td></tr>";
                          while ($row = mysql_fetch_array($result))
                            {
                                $adminID = $row['adminID'];
                                $userName = $row['userName'];
                                $userType = $row['userType'];
                                $libraryNo = $row['libraryNo'];
                                echo "<tr><td width='20%'><input type='checkbox' name='admin[$ctr]' value='$adminID' ><a href=admindetail.php?adminID=$adminID>$userName</a></td>";
                                echo "<td width='30%'>$userType</td></tr>";
                            $ctr++;
                          }
                            echo "<tr><td></td></tr>";
                            echo "<tr><td><input type='submit' value='Delete'></td></tr>";
                          echo "</table>";
                    ?>
                
            </td>
        </tr>
    </table>
    </form>
   </body>
</html>



